package com.hsg.process;

import android.app.ActivityManager;
import android.content.Context;
import android.text.TextUtils;

import java.util.List;

public class Utils {


    public static boolean isRunningService(Context context, String name){
        ActivityManager am=(ActivityManager)context.getSystemService(Context.ACTIVITY_SERVICE);
        List<ActivityManager.RunningServiceInfo> runningServices = am.getRunningServices(100);
        for(ActivityManager.RunningServiceInfo info:runningServices){
            if(TextUtils.equals(info.service.getClassName(),name)){
                return true;
            }
        }
        return false;
    }

}
